package com.aaa.service.impl;

import com.aaa.dao.StudentMapper;
import com.aaa.entity.Student;
import com.aaa.service.StudentService;
import com.aaa.vo.StudentVo;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StudentServiceImpl implements StudentService {
    @Autowired
    private StudentMapper studentMapper;

    @Override
    public PageInfo<Student> selectAll(int current, int pageSize, StudentVo studentVo) {
        //设置分页信息
        PageHelper.startPage(current,pageSize);
        List<Student> list=studentMapper.getAll(studentVo);
        PageInfo<Student> pageInfo = new PageInfo<Student>(list);
        return pageInfo;
    }

    @Override
    public int add(Student student) {
        return studentMapper.addStu(student);
    }

    @Override
    public int delete(Integer id) {
        return studentMapper.delete(id);
    }

    @Override
    public Student getById(int id) {
        return studentMapper.getById(id);
    }

    @Override
    public int update(Student student) {
        return studentMapper.update(student);
    }
}
